package com.example.lanouhn.firstapp.activity.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.example.lanouhn.firstapp.R;

/**
 * Created by lanouhn on 16/7/22.
 */
public class IntoGoodsDetailFragment extends Fragment {
    private String goods_id;
    private WebView webView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_into_goods_detail_fragment, null);
        webView = (WebView) view.findViewById(R.id.webView);

        goods_id = getActivity().getIntent().getStringExtra("str");


//        WebSettings wSet = webView.getSettings();
//        wSet.setJavaScriptEnabled(true);
//        "http://www.niaolema.com/mobile/index.php?act=goods&op=goods_body&goods_id=" + goods_id
//        http://www.niaolema.com/wap/tmpl/product_info.html?goods_id=9245

        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setSupportZoom(true);

        webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        webSettings.setUseWideViewPort(true);


        webView.loadUrl("http://www.niaolema.com/wap/tmpl/product_info.html?goods_id=" + goods_id);


        return view;

    }

//    /**
//     * 拼接网络地址  并将其返回
//     *
//     * @return
//     */
//    private String getRequestUrl() {
//        return "http://www.niaolema.com/mobile/index.php?act=goods&op=goods_body&goods_id=" + goods_id;
//    }

}
